/**
 */
package org.aphelie.chronicle.character.impl;

import org.aphelie.chronicle.ChroniclePackage;
import org.aphelie.chronicle.character.ArcCharacter;
import org.aphelie.chronicle.character.Archetype;
import org.aphelie.chronicle.character.Avatar;
import org.aphelie.chronicle.character.Capacities;
import org.aphelie.chronicle.character.CharacterFactory;
import org.aphelie.chronicle.character.CharacterPackage;

import org.aphelie.chronicle.character.Traits;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class CharacterPackageImpl extends EPackageImpl implements CharacterPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass arcCharacterEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass archetypeEClass = null;
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass traitsEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass capacitiesEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass avatarEClass = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see org.aphelie.chronicle.character.CharacterPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private CharacterPackageImpl() {
		super(eNS_URI, CharacterFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link CharacterPackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static CharacterPackage init() {
		if (isInited) return (CharacterPackage)EPackage.Registry.INSTANCE.getEPackage(CharacterPackage.eNS_URI);

		// Obtain or create and register package
		CharacterPackageImpl theCharacterPackage = (CharacterPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CharacterPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CharacterPackageImpl());

		isInited = true;

		// Initialize simple dependencies
		ChroniclePackage.eINSTANCE.eClass();

		// Create package meta-data objects
		theCharacterPackage.createPackageContents();

		// Initialize created meta-data
		theCharacterPackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theCharacterPackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(CharacterPackage.eNS_URI, theCharacterPackage);
		return theCharacterPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getArcCharacter() {
		return arcCharacterEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getArcCharacter_Traits() {
		return (EReference)arcCharacterEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getArcCharacter_Capacities() {
		return (EReference)arcCharacterEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getArchetype() {
		return archetypeEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getTraits() {
		return traitsEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCapacities() {
		return capacitiesEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getAvatar() {
		return avatarEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getAvatar_Archetype() {
		return (EReference)avatarEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CharacterFactory getCharacterFactory() {
		return (CharacterFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		arcCharacterEClass = createEClass(ARC_CHARACTER);
		createEReference(arcCharacterEClass, ARC_CHARACTER__TRAITS);
		createEReference(arcCharacterEClass, ARC_CHARACTER__CAPACITIES);

		archetypeEClass = createEClass(ARCHETYPE);

		traitsEClass = createEClass(TRAITS);

		capacitiesEClass = createEClass(CAPACITIES);

		avatarEClass = createEClass(AVATAR);
		createEReference(avatarEClass, AVATAR__ARCHETYPE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		ChroniclePackage theChroniclePackage = (ChroniclePackage)EPackage.Registry.INSTANCE.getEPackage(ChroniclePackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		arcCharacterEClass.getESuperTypes().add(theChroniclePackage.getArcTopic());
		archetypeEClass.getESuperTypes().add(theChroniclePackage.getArcSheet());
		archetypeEClass.getESuperTypes().add(this.getArcCharacter());
		traitsEClass.getESuperTypes().add(theChroniclePackage.getArcSheet());
		capacitiesEClass.getESuperTypes().add(theChroniclePackage.getArcSheet());
		avatarEClass.getESuperTypes().add(theChroniclePackage.getArcSheet());
		avatarEClass.getESuperTypes().add(this.getArcCharacter());

		// Initialize classes, features, and operations; add parameters
		initEClass(arcCharacterEClass, ArcCharacter.class, "ArcCharacter", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getArcCharacter_Traits(), this.getTraits(), null, "traits", null, 0, 1, ArcCharacter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getArcCharacter_Capacities(), this.getCapacities(), null, "capacities", null, 0, 1, ArcCharacter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(archetypeEClass, Archetype.class, "Archetype", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(traitsEClass, Traits.class, "Traits", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(capacitiesEClass, Capacities.class, "Capacities", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(avatarEClass, Avatar.class, "Avatar", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getAvatar_Archetype(), this.getArchetype(), null, "archetype", null, 0, 1, Avatar.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		// Create resource
		createResource(eNS_URI);
	}

} //CharacterPackageImpl
